<template>
  <div class="app-container">
    <div v-if="!isLoadFinish && operType == 'edit'" class="empty-info">
      <img :src="loading" alt="loading" width="200px">
    </div>
    <template v-else>
      <!--通过表单配置方式渲染-->
      <el-form
        v-if="FormComponentActive && formBuildConfig.length>0"
        ref="editForm"
        :model="form"
        :size="formConf.size"
        :label-position="formConf.labelPosition"
        :label-width="formConf.labelWidth + 'px'"
        class="content-form"
      >
        <DraggableItem
          v-for="(element, index) in formBuildConfig"
          :key="element.buildKey+nowRenderKey+index"
          :name="'my-component-' + element.formId"
          :drawing-list="formBuildConfig"
          :element="element"
          :index="index"
          :form-conf="formConf"
          :formData="form"
          :formDataOptions="formDataOptions"
          @changeFormData="changeFormData"
          @changeFormDataOptions="changeFormDataOptions"
          @refreshForm="refreshForm"
          @evalEventCode="evalEventCode"
          @assignFormData="assignFormData"
        />
      </el-form>
    </template>
    <!--对话框下方操作按钮-->
    <div v-if="needOperBtn" class="dialog-footer">
      <el-button type="primary" @click="submitForm" v-loading.fullscreen.lock="isSubmitForm" :disabled="isSubmitForm">
        确 定
      </el-button>
      <el-button @click="cancel">取 消</el-button>
    </div>
  </div>
</template>

<script>
import { TableDetailMixins } from '@/views/youshuda/mixins/TableDetailMixins'

export default {
  name: 'FormEdit',
  mixins: [TableDetailMixins],
  methods: {
  }
}
</script>

<style scoped>
  /*.app-container{*/
  /*  height: 100%;*/
  /*}*/
  .dialog-footer {
    position: absolute;
    right: 0;
    bottom: 0;
    width: 100%;
    height: 50px;
    background-color: white;
    left: 0;
    text-align: end;
    padding-right: 30px;
    z-index: 9999;
  }

  .content-form{
    margin-bottom: 30px;
  }

  textarea[readonly="readonly"],
  input[readonly="readonly"] {
    background-color: #F3F3F4 !important;
  }

  .empty-info {
    height: calc(100%);
    display: flex;
    align-items: center;
    justify-content: center;
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    text-align: center;
    font-size: 18px;
    color: #ccb1ea;
    letter-spacing: 4px;
  }
</style>
